package org.algorithm.熊猫.字符串;

import org.algorithm.common.ListNode;
import org.junit.Test;

import java.util.HashMap;
import java.util.Map;

/**
 * @Date 2022/2/23
 * @Link {https://leetcode-cn.com/problems/excel-sheet-column-number/}
 */
public class Excel表列序号 {


    @Test
    public void test() {
        int fxshrxw = titleToNumber("FXSHRXW");
        System.out.println(fxshrxw);
    }

    public int titleToNumber(String s) {
        int sum = 0;
        for (int i = 0; i < s.length(); i++) {
            int c = s.charAt(i) - 64;
            sum=(sum*26+c);
        }
        return sum;
    }
}
